{template "header.html"}
<!-- end header -->

<script type="text/javascript">
    // 获取运费和总价
    function dr_order_address_price(city) {
        $.ajax({
            type: "GET",
            url: '{FC_NOW_URL}&city='+city+'&is_ajax_get=1',
            dataType: "json",
            success: function (json) {
                if (json.code) {
                    $('#dr_freight_value').html(json.data.freight);
                    $('#dr_pay_total_value').html(json.data.total);
                } else {
                    dr_tips(json.code, json.msg);
                }
            },
            error: function(HttpRequest, ajaxOptions, thrownError) {
                alert(HttpRequest.responseText);
            }
        });
    }

</script>
<!-- page wapper-->

<section class="main-content-area">
    <div class="container">
        <!-- bradcame start -->
        <div class="row">
            <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                <div class="greentect_bradcame">
                    <ul>
                        <li><a href="{SITE_URL}">首页</a></li>
                        <li>订单结算</li>
                    </ul>
                </div>
            </div>
        </div>
        <!-- bradcame end -->
        <form class="form-horizontal" method="post" role="form" id="myform">
            {dr_form_hidden()}
            {if $is_address}
            <div class="portlet light bordered" style="box-shadow:0 0px 0px 0px rgba(0,0,0,.03)">
                <div class="portlet-title">
                    <div class="caption">
                        <span class="caption-subject ">收货地址</span>
                    </div>
                </div>
                <div class="portlet-body">
                    <div class="box-border">
                        <ul>
                            {loop $address $t}
                            <li>
                                <label>
                                    <input onclick="dr_order_address_price({$t.city})" type="radio" {if $t.default}checked{/if} name="address" value="{$t.id}">
                                    <a href="javascript:;" onclick="dr_iframe('修改地址', '{dr_url('order/address/index')}&id={$t.id}', '50%', '60%')"><span>{$t.name}</span> <span>{dr_linkagepos(FC_ADDRESS_CITY, $t.city, '', '')}</span> <span>{$t.address}</span>  <span>{$t.phone}</span></a>
                                </label>
                            </li>
                            {if $t.default}
                            <script type="text/javascript">
                                // 获取运费和总价
                                dr_order_address_price({$t.city})
                            </script>
                            {/if}
                            {/loop}
                        </ul>
                        <label style="margin-top: 10px"><a onclick="dr_iframe('新增地址', '{dr_url('order/address/index')}', '50%', '60%')" class=" btn green btn-sm"><i class="fa fa-home"></i> 添加收货地址</a></label>
                    </div>
                </div>
            </div>
            {/if}

            <div class="portlet light bordered" style="box-shadow:0 0px 0px 0px rgba(0,0,0,.03)">
                <div class="portlet-title">
                    <div class="caption">
                        <span class="caption-subject ">付款方式</span>
                    </div>
                </div>
                <div class="portlet-body">
                    <div class="box-border">
                        <ul>
                            {loop $pay_type $name $t}
                            <li>
                                <label>
                                    <input type="radio" {if $pay_default == $name}checked{/if} name="paytype" value="{$name}">
                                    <span>{$t['name']} {if $name == 'finecms'}（￥{$member.money}元）{/if}</span>
                                </label>
                            </li>
                            {/loop}
                        </ul>
                    </div>
                </div>
            </div>

            {loop $order $io $o}
            <div class="portlet light bordered" style="box-shadow:0 0px 0px 0px rgba(0,0,0,.03)">
                <div class="portlet-title">
                    <div class="caption">
                        <a class="caption-subject " href="{$o.mall.url}" target="_blank">{$o.mall.title}</a>
                    </div>
                </div>
                <div class="portlet-body">

                    <table class="table table-bordered table-checkable  ">
                        <thead>
                        <tr>
                            <th class="cart_product text-center">商品</th>
                            <th>详情</th>
                            <th class=" text-center">活动</th>
                            <th class=" text-center">单价</th>
                            <th class=" text-center">数量</th>
                            <th class=" text-center">总价</th>
                        </tr>
                        </thead>
                        <tbody>

                        {loop $o.list $i $t}
                        {php $sku_name=dr_string2array($t.sku_name);}
                        <tr>
                            <td class="cart_product text-center">
                                <a href="{$t.url}" title="{$t.title}"><img width="100" src="{dr_thumb($t.thumb, 90, 90)}"></a>
                            </td>
                            <td class="cart_description">
                                <p class="product-name"> <a href="{$t.url}" title="{$t.title}">{dr_strcut($t.title, 60)}</a></p>
                                {loop $sku_name $i $c}
                                <small class="cart_ref">{$i}: {$c} </small>
                                {/loop}
                            </td>
                            <td class="pprice" style="text-align:center">
                                {if $t.p_name}
                                <p>{$t.p_name}</p>
                                <p class="product-price-group"> <span class="promotion">{$t.p_info}</span></p>
                                {/if}
                            </td>
                            <td class="price pprice" style="text-align: center">
                                {if $t.yuan > 0}
                                <p>￥<span class="regular-price">{number_format($t.price, 2)}</span>元</p>
                                <p class="pyuan">￥<span>{number_format($t.yuan, 2)}</span>元</p>
                                {else}
                                ￥<span class="regular-price">{number_format($t.price, 2)}</span>元
                                {/if}
                            </td>
                            <td class="qty" style="text-align:center">
                                x{$t.num}
                            </td>
                            <td class="price" style="text-align:center">
                                ￥<span class="regular-price">{number_format($t.price * $t.num, 2)}</span>元
                            </td>
                        </tr>
                        {/loop}
                        </tbody>
                        <tfoot>
                        <tr>
                            <td colspan="2" rowspan="6" style="vertical-align: top !important">
                                <textarea style="width:100%;height: 100%" class="form-control" placeholder="买家留言" name="remark"></textarea>
                            </td>
                            <td colspan="2"><strong>总商品金额：</strong></td>
                            <td colspan="2">￥<span class="regular-price">{number_format($o.order_total, 2)}</span>元</td>
                        </tr>

                        {if $o.give_money > 0}
                        <tr>
                            <td colspan="2"><strong>返现金额：</strong></td>
                            <td colspan="2">￥<span class="regular-price">{number_format($give_money, 2)}</span>元</td>
                        </tr>
                        {/if}
                        {if $o.give_score}
                        <tr>
                            <td colspan="2"><strong>赠送{SITE_SCORE}：</strong></td>
                            <td colspan="2"><span class="regular-price">{$o.give_score}</span>{SITE_SCORE}</td>
                        </tr>
                        {/if}
                        {if $o.discount}
                        <tr>
                            <td colspan="2"><strong>{$o.discount.title}：</strong></td>
                            <td colspan="2"><span class="regular-price">{$o.discount.info}</span></td>
                        </tr>
                        {/if}
                        </tfoot>
                    </table>
                </div>
            </div>
            {/loop}



            <div class="text-right margin-bottom-15">
                <strong>运费：</strong>￥<span class="regular-price" id="dr_freight_value">0.00</span>元
            </div>
            <div class="text-right margin-bottom-15">
                <strong>应付总额：</strong>￥<span class="regular-price" id="dr_pay_total_value">{number_format($pay_total, 2)}</span>元
            </div>
            <div class="text-right margin-bottom-15">
                <button type="button" class="button btn green btn-sm" onclick="dr_ajax_submit('{FC_NOW_URL}', 'myform', 1000)">提交订单</button>
            </div>

        </form>

    </div>
</section>


{template "footer.html"}